//
//  AGrantReviewViewController.m
//  DistributorAB
//
//  Created by 主事丫环 on 2019/9/26.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "AGrantReviewViewController.h"
#import "GrantReviewContViewController.h"
#import "SGPagingView.h"

@interface AGrantReviewViewController ()<SGPageTitleViewDelegate, SGPageContentScrollViewDelegate>
@property (nonatomic, strong) SGPageTitleView *pageTitleView;
@property (nonatomic, strong) SGPageContentScrollView *pageContentScrollView;
@property (nonatomic, strong) NSMutableArray *titArr;

@end

@implementation AGrantReviewViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"补助金审核";
    [self.leftbutton setImage:imgname(@"left_icon") forState:(UIControlStateNormal)];
    
    self.titArr = [NSMutableArray arrayWithCapacity:1];
    
    [self showNav];
    // Do any additional setup after loading the view.
}

-(void)showNav{
    
    SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure];
    configure.indicatorAdditionalWidth = 10; // 说明：指示器额外增加的宽度，不设置，指示器宽度为标题文字宽度；若设置无限大，则指示器宽度为按钮宽度
    configure.titleGradientEffect = YES;
    
    configure.titleSelectedColor= zhutiColor;
    configure.titleColor= [UIColor colorWithHexString:@"#999999"];
    configure.indicatorColor = zhutiColor;
    configure.bottomSeparatorColor= [UIColor whiteColor];
    
    NSMutableArray *titleArr = [NSMutableArray arrayWithCapacity:1];
    NSMutableArray *childVCS = [NSMutableArray arrayWithCapacity:1];
    [titleArr addObject:@"全部"];
    [titleArr addObject:@"未审核"];
    [titleArr addObject:@"已审核"];
    
    for (int i = 0; i<titleArr.count; i++) {
        GrantReviewContViewController *oneVC = [[GrantReviewContViewController alloc] init];
        oneVC.type = [NSString stringWithFormat:@"%d",i];
        [childVCS addObject:oneVC];
    }
    self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, kNaviHeight, self.view.frame.size.width, 44) delegate:self titleNames:titleArr configure:configure];
    CGFloat ContentCollectionViewHeight = self.view.frame.size.height - CGRectGetMaxY(_pageTitleView.frame);
    //    self.pageContentScrollView = [[SGPageContentScrollView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_pageTitleView.frame), self.view.frame.size.width, ContentCollectionViewHeight) parentVC:self childVCs:childVCS];
    self.pageContentScrollView = [[SGPageContentScrollView alloc] initWithFrame:CGRectMake(0, kNaviHeight+44, KWIDTH, KHEIGHT-kNaviHeight-44) parentVC:self childVCs:childVCS];
    
    _pageContentScrollView.delegatePageContentScrollView = self;
    [self.view addSubview:self.pageTitleView ];
    
    [self.view addSubview:_pageContentScrollView];
    
    self.pageTitleView.selectedIndex = _seleInd;
    
}

- (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex {
    [self.pageContentScrollView setPageContentScrollViewCurrentIndex:selectedIndex];
    
}

- (void)pageContentScrollView:(SGPageContentScrollView *)pageContentScrollView progress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex {
    [self.pageTitleView setPageTitleViewWithProgress:progress originalIndex:originalIndex targetIndex:targetIndex];
    
    
}

- (void)pageContentScrollView:(SGPageContentScrollView *)pageContentScrollView index:(NSInteger)index {
    //    if (index == 1 || index == 5) {
    //        [_pageTitleView removeBadgeForIndex:index];
    //    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
